package com.hk.core.service.reactive;

import com.hk.commons.query.Order;
import com.hk.commons.query.page.QueryPage;
import com.hk.core.jdbc.query.Condition;
import com.hk.core.jdbc.query.ConditionQueryModel;
import org.springframework.data.domain.Persistable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.io.Serializable;
import java.util.List;

/**
 * @author Kevin
 * @date 2022-07-05 20:19
 */
public interface R2dbcReactiveBaseService<T extends Persistable<ID>, ID extends Serializable>
        extends ReactiveBaseService<T, ID> {

    /**
     * @param t t
     * @return T
     */
    Mono<T> findOne(T t);

    /**
     * 分页查询
     *
     * @param queryModel 查询条件
     * @return 查询结果集
     */
    Mono<QueryPage<T>> queryForPage(ConditionQueryModel queryModel);

    /**
     * @param t      t
     * @param orders orders
     */
    Flux<T> findAll(T t, Order... orders);

    Flux<T> findAll(List<Condition> conditions, Order... orders);
}
